Learn T-SQL Commands with Samples
Skip Navigation Links
Skip Navigation Links.
Expand DatabaseDatabase
Expand TableTable
Expand ViewView
Expand Stored ProcedureStored Procedure
Expand Data FilteringData Filtering
Expand Data GroupingData Grouping
Expand JoinsJoins
Expand TriggerTrigger
Expand CursorCursor
Expand OperatorsOperators
Expand ConstraintsConstraints
Collapse FunctionsFunctions
Expand Conditional ProcessingConditional Processing
Expand LoopingLooping
Expand Error HandlingError Handling
Expand v.IMP Queriesv.IMP Queries
Expand XMLXML
Expand Query PerformanceQuery Performance
Expand QueriesQueries
Expand NormalizationNormalization
Expand CreateCreate
     

Math Functions

 
SELECT

      ABS(-123.45)      as	'ABS',
      CEILING(123.45)   as	'Ceiling',
      FLOOR(123.45)     as	'Floor',
      ROUND(123.45, 0)  as	'Round',
      POWER(3,2)        as	'Power',
      SQRT(25)          as	'SQRT',
      SQUARE(5)         as	'Square',
      SIGN(-123)        as	'SIGN',
      RAND(5)           as	'RAND',
      EXP(5)            as	'EXP',
      PI()              as	'PI',
      DEGREES((PI()/2)) as	'Degress'
    
      
Output
ABS Ceiling Floor Round Power SQRT Square SIGN RAND EXP PI Degress
123.45 124 123 123 9 5 25 -1 0.713666525097956 148.413159102577 3.14159265358979 90